import { BroadCastCall } from "../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../Framework/MQ/MessageBlock";
import { SSeqPlayerItemUpdate } from "../../../../Message/Game/SSeqPlayerItemUpdate";
import { ColorInfo } from "../../resource/info/ColorInfo";
import { SPlayerItemUpdate } from "../../../../Message/Game/SPlayerItemUpdate";
import { PackPosTypeCache } from "../../cache/PackPosTypeCache";
import { ItemData } from "../../resource/info/ItemData";
import { Cache } from "../../cache/Cache";
import { EUpdateType } from "../../../../Message/Public/EUpdateType";
import { UpdateCode } from "../../../component/gconst/UpdateCode";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { NetDispatcher } from "../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../mvc/ServerCommand";
import { ECategory } from "../../../../Message/Public/ECategory";
import { EPlayerItemPosType } from "../../../../Message/Public/EPlayerItemPosType";
import { ItemsUtil } from "../../view/shortcuts/item/ItemsUtil";
import { Global } from "../../../../com/gengine/global/Global";
import { EProp } from "../../../../Message/Public/EProp";
import { ColorConfig } from "../../resource/ColorConfig";
import { MsgManager } from "../../manager/MsgManager";
import { Language } from "../../../../extend/language/Language";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { FairylandTreasureData } from "../../view/copy/FairylandTreasureData";
import { EDrug } from "../../../../Message/Public/EDrug";
type int = number;
//class PackItemCommand
    
    export  class PackItemCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            var mb: MessageBlock;
            var updataItems: SSeqPlayerItemUpdate;
            var colorInfo: ColorInfo;
            var objChangeIndexs: Object;
            var itemChaneNum: Object;
            var addTaskGuideItems: Array<any>;
            var splayerItemUpdate: SPlayerItemUpdate;
            var item: Object;
            var aryChangeIndexBag: Array<any>;
            var aryChangeIndexWarehouse: Array<any>;
            var aryChangeIndexStone: Array<any>;
            var aryChangeIndexMagicWeaponPack: Array<any>;
            var aryChangeIndexRole: Array<any>;
            var aryChangeIndexTask: Array<any>;
            var aryChangeIndexBagExtendBar: Array<any>;
            var aryChangeIndexWarehouseExtendBar: Array<any>;
            var aryChangeIndexMount: Array<any>;
            var aryChangeIndexStall: Array<any>;
            var aryChangeIndexFish: Array<any>;
            var aryChangeIndexRunBusiness: Array<any>;
            var aryChangeIndexTreasure: Array<any>;
            var aryChangeIndexCopyBox: Array<any>;
            var aryChangeIndexDelegate: Array<any>;
            var aryChangeIndexTower: Array<any>;
            var aryChangeIndexPetExplore: Array<any>;
            var aryChangeIndexWardrobe: Array<any>;
            var aryChangeIndexRune: Array<any>;
            var aryChangeIndexPetMingPack: Array<any>;
            var aryChangeIndexPetMingJuPack: Array<any>;
            var getItemChangeNumBuyPosType: Function;
            var getArrayItems: Function;
            var treasureWareHouseCopyCatch: PackPosTypeCache;
            var packPosTypeCatch: PackPosTypeCache;
            var aryPackItems: Array<any>;
            var itemData: ItemData;
            var itemCode: int;
            var fromPoint2: Object /* flash.geom.Point */;
            var uidCopyDel: string;
            var runePackItemData: ItemData;
            var uidUpdate: string;
            var itemDataTreasureWareHouseCopy: ItemData;
            var fromPoint: Object /* flash.geom.Point */;
            var fromPackPosTypeCatch: PackPosTypeCache;
            var fromAryPackItems: Array<any>;
            var uid: string;
            var posIndex: int;
            var fromPackPosTypeCopyCatch: PackPosTypeCache;
            var uidCopy: string;
            var addItemData: ItemData;
            var objTreasureChange: Object;

            var loc1;
            colorInfo = null;
            objChangeIndexs = null;
            itemChaneNum = null;
            splayerItemUpdate = null;
            item = null;
            aryChangeIndexBag = null;
            treasureWareHouseCopyCatch = null;
            packPosTypeCatch = null;
            aryPackItems = null;
            itemData = null;
            itemCode = 0;
            fromPoint2 = null;
            uidCopyDel = null;
            runePackItemData = null;
            uidUpdate = null;
            itemDataTreasureWareHouseCopy = null;
            fromPoint = null;
            fromPackPosTypeCatch = null;
            fromAryPackItems = null;
            uid = null;
            posIndex = 0;
            fromPackPosTypeCopyCatch = null;
            uidCopy = null;
            addItemData = null;
            objTreasureChange = null;
            mb = arg1;
            getItemChangeNumBuyPosType = (arg1: int): Object
            {
                var loc1=null;
                var loc2=null;
                var loc3=null;
                var loc4=0;
                var loc5=itemChaneNum;
                for (loc2 in loc5) 
                {
                    if (((loc3 = itemChaneNum[loc2])["itemData"] as ItemData).posType != arg1) 
                    {
                        continue;
                    }
                    if (!loc1) 
                    {
                        loc1 = new Object();
                    }
                    loc1[loc2] = loc3;
                }
                return loc1;
            }
            getArrayItems = (arg1: int): Array<any>
            {
                if (!objChangeIndexs[arg1]) 
                {
                    objChangeIndexs[arg1] = [];
                }
                return objChangeIndexs[arg1];
            }
            updataItems = mb.messageBase as SSeqPlayerItemUpdate;
            objChangeIndexs = new Object();
            itemChaneNum = {};
            addTaskGuideItems = [];
            this._timerForUpdate = 500;
            this._timerForAdd = 500;
            var loc2=0;
            var loc3=updataItems.playerItemUpdates;
            label4259: for(splayerItemUpdate of loc3) 
            {
                treasureWareHouseCopyCatch = Cache.instance.pack.getCopyCache();
                packPosTypeCatch = Cache.instance.pack.getPackChacheByPosType(splayerItemUpdate.playerItem.posType);
                aryPackItems = getArrayItems(splayerItemUpdate.playerItem.posType);
                itemData = new ItemData(splayerItemUpdate.playerItem);
                itemCode = itemData.itemCode;
                if (itemChaneNum[itemData.itemCode + "-" + splayerItemUpdate.updateType]) 
                {
                    itemChaneNum[itemData.itemCode + "-" + splayerItemUpdate.updateType].updateAmount = itemChaneNum[itemData.itemCode + "-" + splayerItemUpdate.updateType].updateAmount + splayerItemUpdate.updateAmount;
                }
                else 
                {
                    itemChaneNum[itemData.itemCode + "-" + splayerItemUpdate.updateType] = {"updateAmount": splayerItemUpdate.updateAmount, "itemData": itemData};
                }
                if (!packPosTypeCatch || !aryPackItems) 
                {
                    if (splayerItemUpdate.updateType == EUpdateType._EUpdateTypeAdd || splayerItemUpdate.updateAmount > 0) 
                    {
                        if (updataItems.code == UpdateCode.EUpdateCodeTaskAndGuide) 
                        {
                            Dispatcher.dispatchEvent(new DataEvent(EventName.GetTaskItemAndGuide, itemData));
                        }
                    }
                    continue;
                }
                if (updataItems.code == UpdateCode.EUpdateCodeLotteryActiveReward) 
                {
                    NetDispatcher.dispatchCmd(ServerCommand.LotteryActiveRewardFlyToBag, itemData);
                }
                var loc4=splayerItemUpdate.updateType;
                switch (loc4) 
                {
                    case EUpdateType._EUpdateTypeAdd:
                    {
                        if (itemData.itemInfo.item.category != ECategory._ECategoryTask) 
                        {
                            if (packPosTypeCatch.moveBagIn(splayerItemUpdate.posIndex, itemData)) 
                            {
                                aryPackItems.push({"index": splayerItemUpdate.posIndex});
                            }
                            if (itemData.posType == EPlayerItemPosType._EPlayerItemPosTypeBag) 
                            {
                                if (ItemsUtil.isInvitation(itemData)) 
                                {
                                    NetDispatcher.dispatchCmd(ServerCommand.MarryPackInvitesUpdate, null);
                                }
                            }
                            if (updataItems.code != UpdateCode.EUpdateCodeTaskAndGuide) 
                            {
                                if (updataItems.code == UpdateCode.EUpdateCodeMagicTower || updataItems.code == UpdateCode.EUpdateCodePeaceFieldReward || updataItems.code == UpdateCode.EUpdateCodeGuildWar || updataItems.code == UpdateCode.EUpdateCodeGuildStruggle || updataItems.code == UpdateCode.EUpdateCodeArenaCrossActive || updataItems.code == UpdateCode.EUpdateCodeFixStone || updataItems.code == UpdateCode.EUpdateCodeMakeCake || updataItems.code == UpdateCode.EUpdateCodeArenaCross || updataItems.code == UpdateCode.EUpdateCodeDragonGift || updataItems.code == UpdateCode.EUpdateCodeRuneFeedActive || updataItems.code == UpdateCode.EUpdateCodeWuXingUpgradeAccActive || updataItems.code == UpdateCode.EUpdateCodeWuXingRefreshAccActive || updataItems.code == UpdateCode.EUpdateCodePetSkillRefreshActive || updataItems.code == UpdateCode.EUpdateCodeJewelAdvanceActive || updataItems.code == UpdateCode.EUpdateCodeMountAdvancePropRetActive || updataItems.code == UpdateCode.EUpdateCodeBlessGift || updataItems.code == UpdateCode.EUpdateCodeEatBeans || updataItems.code == UpdateCode.EUpdateCodePlantFlowerActive || updataItems.code == UpdateCode.EUpdateCodePlantFlowerBlessReward || updataItems.code == UpdateCode.EUpdateCodeCountryMoney || updataItems.code == UpdateCode.EupdateCodeCopySealReward || updataItems.code == UpdateCode.EUpdateCodeMountUpgradeActive || updataItems.code == UpdateCode.EUpdateCodeMountFosterActive || updataItems.code == UpdateCode.EUpdateCodeMountStarsCultrueActive || updataItems.code == UpdateCode.EUpdateCodeEquipRefresh || updataItems.code == UpdateCode.EUpdateCodeCrossGuildWar || updataItems.code == UpdateCode.EUpdateCodeLuckyBag || updataItems.code == UpdateCode.EUpdateCodeMountCopyDrop || updataItems.code == UpdateCode.EUpdateCodeHolidaySign || updataItems.code == UpdateCode.EUpdateCodeNewDayRechargeGiftBag || updataItems.code == UpdateCode.EUpdateCodeNewCumulateRecharge) 
                                {
                                    this.SpecilShowMsg(itemData, updataItems.code, splayerItemUpdate.updateAmount);
                                    this.flyToBackpack(itemData);
                                }
                                else if (updataItems.code != UpdateCode.EUpdateCodeCrossDefenseReward) 
                                {
                                    if (updataItems.code != UpdateCode.EUpdateCodeDragonGold) 
                                    {
                                        if (updataItems.code != UpdateCode.EUpdateCodeMergeCopy) 
                                        {
                                            if (updataItems.code != UpdateCode.EUpdateCodeCopyMarkTask) 
                                            {
                                                if (updataItems.code != UpdateCode.EUpdateCodeLifeStyleHunt) 
                                                {
                                                    if (updataItems.code != UpdateCode.EUpdateCodeNpcAward) 
                                                    {
                                                        if (itemData.itemInfo.item.level >= 10) 
                                                        {
                                                            if (itemData.itemInfo.item.category == ECategory._ECategoryEquip && itemData.posType == EPlayerItemPosType._EPlayerItemPosTypeBag) 
                                                            {
                                                                Dispatcher.dispatchEvent(new DataEvent(EventName.GetNewEquip, itemData));
                                                            }
                                                        }
                                                    }
                                                    else 
                                                    {
                                                        NetDispatcher.dispatchCmd(ServerCommand.NpcAwardItemUpate, itemData);
                                                    }
                                                }
                                                else 
                                                {
                                                    NetDispatcher.dispatchCmd(ServerCommand.PetMingJuGetItemCommand, itemData);
                                                }
                                            }
                                            else 
                                            {
                                                Dispatcher.dispatchEvent(new DataEvent(EventName.DailyCopyMarkReward, itemData));
                                            }
                                        }
                                        else 
                                        {
                                            flash.utils.setTimeout(this.flyToBackpack, 500, itemData);
                                        }
                                    }
                                    else 
                                    {
                                        Dispatcher.dispatchEvent(new DataEvent(EventName.BackPackFlyGoldToPack));
                                    }
                                }
                                else 
                                {
                                    fromPoint2 = new Object /* flash.geom.Point */(Global.stage.stageWidth - 50, 100);
                                    flash.utils.setTimeout(this.flyToBackPackFromPoint, this._timerForAdd, {"itemData": itemData, "point": fromPoint2});
                                    this._timerForAdd = this._timerForAdd + 50;
                                }
                            }
                            else if (!ItemsUtil.isPetSkillBook(itemData)) 
                            {
                                addTaskGuideItems.push(itemData);
                            }
                        }
                        else if (packPosTypeCatch.moveInTaskBag(splayerItemUpdate.posIndex, itemData)) 
                        {
                            aryPackItems.push({"index": splayerItemUpdate.posIndex});
                            Dispatcher.dispatchEvent(new DataEvent(EventName.BackPackAddTaskEntity, itemData));
                        }
                        if (Cache.instance.guide.guideUseDrug) 
                        {
                            if (ItemsUtil.isChangeshengdan(itemData) || ItemsUtil.isButianwan(itemData)) 
                            {
                                Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_UseDrug));
                            }
                        }
                        continue label4259;
                    }
                    case EUpdateType._EUpdateTypeDel:
                    {
                        if (itemData.itemInfo.item.category != ECategory._ECategoryTask) 
                        {
                            if (packPosTypeCatch.moveBagOut(splayerItemUpdate.posIndex, splayerItemUpdate.playerItem)) 
                            {
                                aryPackItems.push({"index": splayerItemUpdate.posIndex});
                            }
                        }
                        else if (packPosTypeCatch.moveOutTaskBag(itemData.uid, splayerItemUpdate.playerItem)) 
                        {
                            aryPackItems.push({"index": splayerItemUpdate.posIndex});
                        }
                        if (splayerItemUpdate.fromPosType == EPlayerItemPosType._EPlayerItemPosTypeTreasure) 
                        {
                            uidCopyDel = splayerItemUpdate.playerItem.uid;
                            treasureWareHouseCopyCatch.removeItemByUid(uidCopyDel);
                        }
                        continue label4259;
                    }
                    case EUpdateType._EUpdateTypeUpdate:
                    {
                        if (updataItems.code == UpdateCode.EUpdateCodeRuneFeed) 
                        {
                            runePackItemData = Cache.instance.pack.getPackChacheByPosType(itemData.posType).getItemDataByUid(itemData.uid);
                            if (runePackItemData && !(itemData.itemCode == runePackItemData.itemCode)) 
                            {
                                NetDispatcher.dispatchCmd(ServerCommand.RuneLevelUp, null);
                            }
                        }
                        if (ItemsUtil.isTaskSilverNote(itemData)) 
                        {
                            Dispatcher.dispatchEvent(new DataEvent(EventName.RunBusinessSilverNoteChange, itemData));
                        }
                        if (itemData.itemInfo.item.category != ECategory._ECategoryTask) 
                        {
                            if (packPosTypeCatch.changeBag(splayerItemUpdate.posIndex, splayerItemUpdate.playerItem)) 
                            {
                                aryPackItems.push({"index": splayerItemUpdate.posIndex});
                            }
                            if (itemData.posType == EPlayerItemPosType._EPlayerItemPosTypeBag) 
                            {
                                if (ItemsUtil.isInvitation(itemData) && splayerItemUpdate.updateAmount > 0) 
                                {
                                    NetDispatcher.dispatchCmd(ServerCommand.MarryPackInvitesUpdate, null);
                                }
                            }
                            if (splayerItemUpdate.fromPosType == EPlayerItemPosType._EPlayerItemPosTypeTreasure) 
                            {
                                uidUpdate = splayerItemUpdate.playerItem.uid;
                                itemDataTreasureWareHouseCopy = treasureWareHouseCopyCatch.getItemDataByUid(uidUpdate);
                                if (itemData && itemData.itemAmount >= splayerItemUpdate.playerItem.itemAmount) 
                                {
                                    treasureWareHouseCopyCatch.removeItemByUid(uidUpdate);
                                }
                            }
                        }
                        else if (packPosTypeCatch.moveInTaskBag(splayerItemUpdate.posIndex, itemData)) 
                        {
                            aryPackItems.push({"index": splayerItemUpdate.posIndex});
                            Dispatcher.dispatchEvent(new DataEvent(EventName.BackPackAddTaskEntity, itemData));
                        }
                        if (splayerItemUpdate.updateAmount > 0) 
                        {
                            if (updataItems.code == UpdateCode.EUpdateCodeTaskAndGuide) 
                            {
                                addTaskGuideItems.push(itemData);
                            }
                            if (updataItems.code == UpdateCode.EUpdateCodeMagicTower || updataItems.code == UpdateCode.EUpdateCodePeaceFieldReward || updataItems.code == UpdateCode.EUpdateCodeGuildWar || updataItems.code == UpdateCode.EUpdateCodeGuildPartyFood || updataItems.code == UpdateCode.EUpdateCodeGuildStruggle || updataItems.code == UpdateCode.EUpdateCodeArenaCrossActive || updataItems.code == UpdateCode.EUpdateCodeFixStone || updataItems.code == UpdateCode.EUpdateCodeMakeCake || updataItems.code == UpdateCode.EUpdateCodeArenaCross || updataItems.code == UpdateCode.EUpdateCodeDramaCopy || updataItems.code == UpdateCode.EUpdateCodeDragonGift || updataItems.code == UpdateCode.EUpdateCodeRuneFeedActive || updataItems.code == UpdateCode.EUpdateCodeWuXingUpgradeAccActive || updataItems.code == UpdateCode.EUpdateCodeWuXingRefreshAccActive || updataItems.code == UpdateCode.EUpdateCodePetSkillRefreshActive || updataItems.code == UpdateCode.EUpdateCodeJewelAdvanceActive || updataItems.code == UpdateCode.EUpdateCodeMountAdvancePropRetActive || updataItems.code == UpdateCode.EUpdateCodeBlessGift || updataItems.code == UpdateCode.EUpdateCodeEatBeans || updataItems.code == UpdateCode.EUpdateCodePlantFlowerActive || updataItems.code == UpdateCode.EUpdateCodePlantFlowerBlessReward || updataItems.code == UpdateCode.EupdateCodeCopySealReward || updataItems.code == UpdateCode.EUpdateCodeMountUpgradeActive || updataItems.code == UpdateCode.EUpdateCodeMountFosterActive || updataItems.code == UpdateCode.EUpdateCodeMountStarsCultrueActive || updataItems.code == UpdateCode.EUpdateCodeEquipRefresh || updataItems.code == UpdateCode.EUpdateCodeCrossGuildWar || updataItems.code == UpdateCode.EUpdateCodeLuckyBag || updataItems.code == UpdateCode.EUpdateCodeMountCopyDrop || updataItems.code == UpdateCode.EUpdateCodeHolidaySign || updataItems.code == UpdateCode.EUpdateCodeNewDayRechargeGiftBag || updataItems.code == UpdateCode.EUpdateCodeNewCumulateRecharge) 
                            {
                                this.SpecilShowMsg(itemData, updataItems.code, splayerItemUpdate.updateAmount);
                                this.flyToBackpack(itemData);
                            }
                            else if (updataItems.code != UpdateCode.EUpdateCodeCrossDefenseReward) 
                            {
                                if (updataItems.code != UpdateCode.EUpdateCodeDragonGold) 
                                {
                                    if (updataItems.code != UpdateCode.EUpdateCodeMergeCopy) 
                                    {
                                        if (updataItems.code != UpdateCode.EUpdateCodeCopyMarkTask) 
                                        {
                                            if (updataItems.code == UpdateCode.EUpdateCodeNpcAward) 
                                            {
                                                NetDispatcher.dispatchCmd(ServerCommand.NpcAwardItemUpate, itemData);
                                            }
                                        }
                                        else 
                                        {
                                            Dispatcher.dispatchEvent(new DataEvent(EventName.DailyCopyMarkReward, itemData));
                                        }
                                    }
                                    else 
                                    {
                                        flash.utils.setTimeout(this.flyToBackpack, 500, itemData);
                                    }
                                }
                                else 
                                {
                                    Dispatcher.dispatchEvent(new DataEvent(EventName.BackPackFlyGoldToPack));
                                }
                            }
                            else 
                            {
                                fromPoint = new Object /* flash.geom.Point */(Global.stage.stageWidth - 50, 100);
                                flash.utils.setTimeout(this.flyToBackPackFromPoint, this._timerForUpdate, {"itemData": itemData, "point": fromPoint});
                                this._timerForUpdate = this._timerForUpdate + 50;
                            }
                            if (Cache.instance.guide.guideUseDrug) 
                            {
                                if (ItemsUtil.isChangeshengdan(itemData) || ItemsUtil.isButianwan(itemData)) 
                                {
                                    Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_UseDrug));
                                }
                            }
                        }
                        if (splayerItemUpdate.fromPosType != splayerItemUpdate.playerItem.posType) 
                        {
                            if (this.isExchangePosType(splayerItemUpdate.fromPosType, splayerItemUpdate.playerItem.posType)) 
                            {
                                fromPackPosTypeCatch = Cache.instance.pack.getPackChacheByPosType(splayerItemUpdate.fromPosType);
                                fromAryPackItems = getArrayItems(splayerItemUpdate.fromPosType);
                                uid = splayerItemUpdate.playerItem.uid;
                                posIndex = fromPackPosTypeCatch.getIndexByUid(uid);
                                if (fromPackPosTypeCatch.removeItemByUid(uid)) 
                                {
                                    fromAryPackItems.push({"index": posIndex});
                                }
                                if (splayerItemUpdate.fromPosType == EPlayerItemPosType._EPlayerItemPosTypeTreasure) 
                                {
                                    fromPackPosTypeCopyCatch = Cache.instance.pack.getCopyCache();
                                    uidCopy = splayerItemUpdate.playerItem.uid;
                                    fromPackPosTypeCopyCatch.removeItemByUid(uidCopy);
                                }
                            }
                        }
                        continue label4259;
                    }
                    default:
                    {
                        continue label4259;
                    }
                }
            }
            loc2 = 0;
            loc3 = itemChaneNum;
            for(item of loc3) 
            {
                if (item.updateAmount > 0) 
                {
                    if (!(item.itemData.itemInfo.item.category == ECategory._ECategoryPet) && !(item.itemData.data.posType == EPlayerItemPosType._EPlayerItemPosTypeGuildWarehouse) && item.itemData.data.posType < EPlayerItemPosType._EPlayerItemPosTypePetEquipBase && !(updataItems.code == UpdateCode.EUpdateCodeUseLotteryCopy) && !(item.itemData.itemInfo.item.category == ECategory._ECategoryProp && item.itemData.itemInfo.item.type == EProp._EPropCopyBox) && !(item.itemData.data.posType == EPlayerItemPosType._EPlayerItemPosTypeCrossDefense) && !(updataItems.code == UpdateCode.EUpdateCodeBagSplit) && !(updataItems.code == UpdateCode.EUpdateCodeBagMove) && !(updataItems.code == UpdateCode.EUpdateCodeWarehouseMove) && !(updataItems.code == UpdateCode.EUpdateCodePloughRewardToBag)) 
                    {
                        colorInfo = ColorConfig.instance.getItemColor(item.itemData.itemInfo.item.color);
                        MsgManager.addTipText(Language.getStringByParam(40086, item.updateAmount.toString(), HTMLUtil.addColor(item.itemData.itemInfo.item.name, colorInfo.color)));
                    }
                    if (item.itemData.itemInfo.item.category == ECategory._ECategoryProp) 
                    {
                        if (item.itemData.itemInfo.item.type != EProp._EPropHuntMap) 
                        {
                            if (item.itemData.itemInfo.item.type == EProp._EPropHuntShovel) 
                            {
                                MsgManager.showRollTipsMsg(Language.getStringByParam(40088, item.updateAmount.toString(), HTMLUtil.addColor(item.itemData.itemInfo.item.name, colorInfo.color)));
                            }
                        }
                        else 
                        {
                            MsgManager.showRollTipsMsg(Language.getStringByParam(40087, item.updateAmount.toString(), HTMLUtil.addColor(item.itemData.itemInfo.item.name, colorInfo.color)));
                        }
                    }
                    if (updataItems.code == UpdateCode.EUpdateCodeUseLotteryCopy) 
                    {
                        addItemData = new ItemData(item.itemData.itemCode);
                        addItemData.itemAmount = item.updateAmount;
                        FairylandTreasureData.recordItemData(addItemData);
                    }
                    if (item.itemData.itemInfo.item.type == EDrug._EDrugLife || item.itemData.itemInfo.item.type == EDrug._EDrugMana) 
                    {
                        if (item.itemData.itemInfo.item.effect == 0) 
                        {
                            Dispatcher.dispatchEvent(new DataEvent(EventName.RoleAutoResume));
                        }
                        if (item.itemData.itemInfo.item.effect == 2) 
                        {
                            Dispatcher.dispatchEvent(new DataEvent(EventName.PetAutoResume));
                        }
                    }
                    if (item.itemData.itemInfo.item.type == EProp._EPropSkillBook) 
                    {
                        Dispatcher.dispatchEvent(new DataEvent(EventName.GetSkillBook));
                    }
                }
                else if (item.updateAmount < 0) 
                {
                    if (!(item.itemData.itemInfo.item.category == ECategory._ECategoryPet) && !(item.itemData.data.posType == EPlayerItemPosType._EPlayerItemPosTypeGuildWarehouse) && item.itemData.data.posType < EPlayerItemPosType._EPlayerItemPosTypePetEquipBase && !(item.itemData.itemInfo.item.category == ECategory._ECategoryProp && item.itemData.itemInfo.item.type == EProp._EPropCopyBox) && !(item.itemData.data.posType == EPlayerItemPosType._EPlayerItemPosTypeCrossDefense) && !(updataItems.code == UpdateCode.EUpdateCodeBagSplit) && !(updataItems.code == UpdateCode.EUpdateCodeBagMove) && !(updataItems.code == UpdateCode.EUpdateCodeWarehouseMove) && !(updataItems.code == UpdateCode.EUpdateCodePloughRewardToBag)) 
                    {
                        colorInfo = ColorConfig.instance.getItemColor(item.itemData.itemInfo.item.color);
                        MsgManager.addTipText(Language.getStringByParam(40089, Math.abs(item.updateAmount).toString(), HTMLUtil.addColor(item.itemData.name, colorInfo.color)));
                    }
                }
                else if (splayerItemUpdate.updateAmount != 0) 
                {
                };
                if (!(!objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeDelegate] && !objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeTower] && !objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeFish] && !objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeWarehouse] && !(objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeBag] && item.updateAmount < 0) || item.updateAmount == 0 && (objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeDelegate] || objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeTower] || objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeFish]))) 
                {
                    continue;
                }
                if (item.itemData.itemInfo.item.category != ECategory._ECategoryIllustrate) 
                {
                    continue;
                }
                Dispatcher.dispatchEvent(new DataEvent(EventName.IllustrateItemAdd, item.itemData));
            }
            aryChangeIndexBag = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeBag];
            if (aryChangeIndexBag && aryChangeIndexBag.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.BackPackItemsChange, null);
            }
            aryChangeIndexWarehouse = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeWarehouse];
            if (aryChangeIndexWarehouse && aryChangeIndexWarehouse.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.WareHouseItemsChange, null);
            }
            aryChangeIndexStone = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeStoneBag];
            if (aryChangeIndexStone && aryChangeIndexStone.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.StonepackItemsChange, null);
            }
            aryChangeIndexMagicWeaponPack = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeAmuletBag];
            if (aryChangeIndexMagicWeaponPack && aryChangeIndexMagicWeaponPack.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.MagicWeaponPackItemsChange, null);
            }
            aryChangeIndexRole = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeRole];
            if (aryChangeIndexRole && aryChangeIndexRole.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.RolePackItemsChange, objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeRole]);
            }
            aryChangeIndexTask = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeTask];
            if (aryChangeIndexTask && aryChangeIndexTask.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.BackPackTaskItemsChange, objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeTask]);
            }
            aryChangeIndexBagExtendBar = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeBagExtendBar];
            if (aryChangeIndexBagExtendBar && aryChangeIndexBagExtendBar.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.BackPackExtendItemsChange, null);
            }
            aryChangeIndexWarehouseExtendBar = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeWarehouseExtendBar];
            if (aryChangeIndexWarehouseExtendBar && aryChangeIndexWarehouseExtendBar.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.WareHouseExtendItemsChange, null);
            }
            aryChangeIndexMount = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeMount];
            if (!(aryChangeIndexMount && aryChangeIndexMount.length > 0)) 
            {
            };
            aryChangeIndexStall = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeStall];
            if (aryChangeIndexStall && aryChangeIndexStall.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.StallItemsUpdate, true);
            }
            aryChangeIndexFish = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeFish];
            if (aryChangeIndexFish && aryChangeIndexFish.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.FishItemsUpdate, true);
            }
            aryChangeIndexRunBusiness = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeRunBusiness];
            if (aryChangeIndexRunBusiness && aryChangeIndexRunBusiness.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.BackPackRunBusinessPackChange, true);
            }
            aryChangeIndexTreasure = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeTreasure];
            if (aryChangeIndexTreasure && aryChangeIndexTreasure.length > 0) 
            {
                objTreasureChange = getItemChangeNumBuyPosType(EPlayerItemPosType._EPlayerItemPosTypeTreasure);
                if (updataItems.code != UpdateCode.EUpdateCodeUseLotteryActive) 
                {
                    NetDispatcher.dispatchCmd(ServerCommand.BackPackTreasureGetItemsChange, objTreasureChange);
                }
                else if (aryChangeIndexTreasure && aryChangeIndexTreasure.length > 0) 
                {
                    NetDispatcher.dispatchCmd(ServerCommand.BackPackChristmasCommand, objTreasureChange);
                }
                NetDispatcher.dispatchCmd(ServerCommand.BackPackTreasurePackChange, null);
            }
            aryChangeIndexCopyBox = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeCopyBox];
            if (aryChangeIndexCopyBox && aryChangeIndexCopyBox.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.CopyBoxItemUpdate, null);
            }
            aryChangeIndexDelegate = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeDelegate];
            if (aryChangeIndexDelegate && aryChangeIndexDelegate.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.DelegateWarehouseItemsUpdate, null);
            }
            aryChangeIndexTower = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeTower];
            if (aryChangeIndexTower && aryChangeIndexTower.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.TowerWarehouseItemsUpdate, null);
            }
            aryChangeIndexPetExplore = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypePetExplore];
            if (aryChangeIndexPetExplore && aryChangeIndexPetExplore.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.PetExplorePackItemUpdate, null);
            }
            aryChangeIndexWardrobe = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeWardrobe];
            if (aryChangeIndexWardrobe && aryChangeIndexWardrobe.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.BackPackWardrobeItemsChange, null);
            }
            aryChangeIndexRune = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypeRune];
            if (aryChangeIndexRune && aryChangeIndexRune.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.RunePackItemsChange, null);
            }
            if (this.isChangePetEquip(objChangeIndexs)) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.PetEquipItemInfoChange, null);
            }
            aryChangeIndexPetMingPack = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypePetLifeStypePut];
            if (aryChangeIndexPetMingPack && aryChangeIndexPetMingPack.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.PetMingPackCommand, null);
            }
            aryChangeIndexPetMingJuPack = objChangeIndexs[EPlayerItemPosType._EPlayerItemPosTypePetLifeStypeHunt];
            if (aryChangeIndexPetMingJuPack && aryChangeIndexPetMingJuPack.length > 0) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.PetMingJuPackCommand, true);
            }
            while (addTaskGuideItems.length > 0) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.GetTaskItemAndGuide, addTaskGuideItems.shift()));
            }
            return;
        }

        /* internal  */getPackCatch(arg1: int): PackPosTypeCache
        {
            var loc1=arg1;
            switch (loc1) 
            {
                case 0:
                {
                    return Cache.instance.pack.backPackCache;
                }
                case 3:
                {
                    return Cache.instance.pack.rolePackCache;
                }
                case 7:
                {
                    return Cache.instance.pack.mountsPackCache;
                }
                default:
                {
                    return null;
                }
            }
        }

        /* internal  */flyToBackpack(arg1: ItemData): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.BackPackAddTaskEntity, arg1));
            return;
        }

        /* internal  */flyToBackPackFromPoint(arg1: Object): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.BackPackFlyToPack, arg1));
            return;
        }

        /* internal  */isChangePetEquip(arg1: Object): Boolean
        {
            var loc1=null;
            var loc2=0;
            var loc3=arg1;
            for (loc1 in loc3) 
            {
                if (!(parseInt(loc1) >= EPlayerItemPosType._EPlayerItemPosTypePetEquipBase)) 
                {
                    continue;
                }
                return true;
            }
            return false;
        }

        /* internal  */isExchangePosType(arg1: int, arg2: int): Boolean
        {
            var loc1=arg1;
            switch (loc1) 
            {
                case EPlayerItemPosType._EPlayerItemPosTypeTreasure: case EPlayerItemPosType._EPlayerItemPosTypeFish: case EPlayerItemPosType._EPlayerItemPosTypeDelegate: case EPlayerItemPosType._EPlayerItemPosTypePetExplore: case EPlayerItemPosType._EPlayerItemPosTypeTower: case EPlayerItemPosType._EPlayerItemPosTypePetLifeStypeHunt:
                {
                    return true;
                }
            }
            if (arg1 >= EPlayerItemPosType._EPlayerItemPosTypePetEquipBase) 
            {
                return true;
            }
            if (arg1 == EPlayerItemPosType._EPlayerItemPosTypeBag && arg2 >= EPlayerItemPosType._EPlayerItemPosTypePetEquipBase) 
            {
                return true;
            }
            if (arg2 == EPlayerItemPosType._EPlayerItemPosTypeStoneBag || arg2 == EPlayerItemPosType._EPlayerItemPosTypeAmuletBag) 
            {
                return true;
            }
            return false;
        }

        /* internal  */SpecilShowMsg(arg1: ItemData, arg2: int, arg3: int): void
        {
            var loc1=null;
            var loc2=null;
            if (arg2 == UpdateCode.EUpdateCodeRuneFeedActive || arg2 == UpdateCode.EUpdateCodeWuXingUpgradeAccActive || arg2 == UpdateCode.EUpdateCodeWuXingRefreshAccActive || arg2 == UpdateCode.EUpdateCodePetSkillRefreshActive || arg2 == UpdateCode.EUpdateCodeJewelAdvanceActive || arg2 == UpdateCode.EUpdateCodeMountAdvancePropRetActive || arg2 == UpdateCode.EUpdateCodeBlessGift || arg2 == UpdateCode.EUpdateCodeMountUpgradeActive || arg2 == UpdateCode.EUpdateCodeMountFosterActive || arg2 == UpdateCode.EUpdateCodeMountStarsCultrueActive || arg2 == UpdateCode.EUpdateCodeEquipRefresh) 
            {
                loc1 = "*" + arg3;
                loc2 = Language.getStringByParam(70921, ItemsUtil.getItemName(arg1) + ItemsUtil.getItemName(arg1, loc1));
                MsgManager.showRollTipsMsg(loc2);
            }
            return;
        }

        private /* var */_timerForUpdate: int;

        private /* var */_timerForAdd: int;
    }
